package com.app.fragmentmodule.dagger

import androidx.fragment.app.Fragment
import com.app.fragmentmodule.business.four.FragmentFour
import com.app.fragmentmodule.business.four.dagger.FragmentFourComponent
import com.app.fragmentmodule.business.one.FragmentOne
import com.app.fragmentmodule.business.one.dagger.FragmentOneComponent
import com.app.fragmentmodule.business.three.FragmentThree
import com.app.fragmentmodule.business.three.dagger.FragmentThreeComponent
import com.app.fragmentmodule.business.two.FragmentTwo
import com.app.fragmentmodule.business.two.dagger.FragmentTwoComponent
import dagger.Module
import dagger.Provides
import dagger.android.AndroidInjector
import dagger.android.support.FragmentKey
import dagger.multibindings.IntoMap

/**
 *@创建人 周文东
 *@创建时间 2019/11/9
 *@描述
 */

@Module(subcomponents = [FragmentOneComponent::class, FragmentTwoComponent::class, FragmentThreeComponent::class, FragmentFourComponent::class])
class FragmentModuleActivityModule {

    @Provides
    @IntoMap
    @FragmentKey(FragmentOne::class)
    internal fun bindFragmentOne(factory: FragmentOneComponent.Builder): AndroidInjector.Factory<out Fragment> = factory

    //@Binds
    @Provides
    @IntoMap
    @FragmentKey(FragmentTwo::class)
    internal fun bindFragmentTwo(factory: FragmentTwoComponent.Builder): AndroidInjector.Factory<out Fragment> = factory

    @Provides
    @IntoMap
    @FragmentKey(FragmentThree::class)
    internal fun bindFragmentThree(factory: FragmentThreeComponent.Builder): AndroidInjector.Factory<out Fragment> = factory

    @Provides
    @IntoMap
    @FragmentKey(FragmentFour::class)
    internal fun bindFragmentFour(factory: FragmentFourComponent.Builder): AndroidInjector.Factory<out Fragment> = factory

}
